perf: Int::decode small-value fast path#717
Merged
Conversation
Click to see raw report |
Decode SLEB128-encoded Int values into i64 first, only falling back to BigInt for values that exceed 64-bit range. Mirrors the existing Nat::decode fast path. Benchmark: option_list decoding 26.2M → 23.2M instructions (-11.7%), variant_list decoding 25.1M → 22.1M instructions (-11.9%), heap usage halved for both. Wire format is unchanged. Made-with: Cursor
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
a17141e to
db3bdea
Compare
lwshang
approved these changes
Mar 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Decode SLEB128-encoded
Intvalues intoi64first, only falling back toBigIntfor values that exceed 64-bit range. Mirrors the existingNat::decodefast path from an earlier commit in this series.i64with proper sign extensioni64toBigIntand continues withBigIntarithmeticIntvalues fit ini64, avoiding heap allocation entirelyBenchmark (canbench, wasm32)
No regressions on any of the 9 benchmarks.
Compatibility
Wire format is unchanged. Additional edge-case values added to the round-trip compatibility test (Int(0), Int(i64::MAX), large positive Int).
Relates to #710